<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="/jsp/employInfo/taglib/taglib.jsp"%>

<html>

<head>
<script type="text/javascript">
	setInterval('starTime()', 1000);
	function myFunction() {
		document.getElementById("demo").innerHTML = "My First JavaScript Function";
	}

	function wr() {
		document.write("糟糕！文档消失了。");//方法名都好重要，一样会无法出现
	}

	function warn() {
		var name = document.getElementById("emailId").value;
		var txt = "this is null";
		if (name == null || name == "") {
			document.getElementById("emailName").value = name;
			alert(txt);

			return false;
		} else {

			return true;
		}
	}

	function starTime() {

		var today = new Date()
		var h = today.getHours()
		var m = today.getMinutes()
		var s = today.getSeconds()
		m = checkTime(m);
		s = checkTime(s);

		document.getElementById("time").innerHTML = h + ":" + m + ":" + s

	}
	function checkTime(i) {
		if (i < 10) {
			i = "0" + i
		}
		return i
	}

	var patt2 = new RegExp("e", "g");
	do {
		result = patt2.exec("The best things in life are free");
		document.write(result + "<br>");
	} while (result != null)

	var patt1 = new RegExp("e");
	document.write(patt1.test("The best things in life are free"));

	patt1.compile("d");

	document.write(patt1.test("The best things in life are free") + "<br>");

	function wind() {
		var w = window.innerWidth || documentElement.clientWidth
				|| document.body.clientWidth;
		var h = window.innerHeight || document.documentElement.clientHeight
				|| document.body.clientHeight;
		x = document.getElementById("window");
		x.innerHTML = "浏览器的内部窗口宽度：" + w + "，高度：" + h + "。" + "<br>"
	};
	document.write(location.href + "<br>");
	document.write(location.pathname);
	function goback() {
		history.back();
	}

	function getCookie(u_name) {
		if (document.cookie.length > 0) {
			c_start = document.cookie.indexOf(u_name + "=")
			if (c_start != -1) {
				c_start = c_start + u_name.length + 1;
				c_end = document.cookie.indexOf(";", c_start);
				if (c_end == -1) {
					c_end = document.cookie.length;
				}
				return unescape(document.cookie.substring(c_start, c_end));
			}
		}
	}

	function setCookie(u_name, value, expiredays) {
		var exdate = new Date();
		exdate.setDate(exdate.getDate() + expiredays);
		document.cookie = u_name
				+ "="
				+ escape(value)
				+ ((expiredays == null) ? "" : ";expires="
						+ exdate.toGMTString());

	}

	function checkCookie() {
		username = getCookie("username");
		if (username != null && username != "") {
			alert('welcome again ' + username + '!')
		} else {
			username = prompt("please enter your name", "your name")
			if (username != null && username != "") {
				setCookie("username", username, 365)
			}
		}

	}
</script>

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>js</title>

</head>
<body onload="checkCookie()">
	<h1>My First Web Page</h1>
	<button id="demo" onclick="myFunction()">My First Paragraph</button>
	<button onclick="wr()">write.deep</button>




	<form action="http://www.baidu.com/" onsubmit="return warn()"
		id="email">
		Email :<input id="emailId" type="text" size="40" value=""> <input
			type="submit" value="submit">
	</form>
	emailName:
	<input id="emailName" value="{emailName}" />
	<input id="what" value="" />
	<div id="time" onclick="starTime()">asc</div>
	<p id="window" onclick="wind()">a</p>
	<a href="/html/test.jsp">test</a>
	<button id="goback" onclick="goback()">back</button>
</body>
</html>